#include<unistd.h>
#include<iostream>
#include<pthread.h>
using namespace std;

void* Routine(void* arg)
{
  pthread_detach(pthread_self());
  while(1)
  {
    cout <<" I am pthread:" <<pthread_self() << endl;
    sleep(2);
  }
}

int main()
{
  pthread_t tid;
  pthread_create(&tid,nullptr,Routine,nullptr);
  
  cout <<"main thread exit...." << endl;
  pthread_exit(nullptr);
 
  return 0;
}
